package com.xiaoran.springbt02web.controller;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ParameterController {
    @GetMapping("/car/{id}/owner/{username}")
    public Map<String,Object> getCar(@PathVariable("id")Integer id,
                                     @PathVariable("username") String name,
                                     @RequestHeader("User-Agent") String user_Agent,
                                     @RequestHeader Map<String,String> user_map,
                                     @PathVariable Map<String,String> pv/*这个就是把我们写的所有的都保存在这里面*/){

        Map<String,Object> map=new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("pv",pv);
        map.put("User-Agent",user_Agent);
        map.put("user_map",user_map);
        return  map;
        }
     @GetMapping("/tt")
    public Map<String,Object> getCat(@RequestParam("age") Integer age){
        Map<String,Object> map=new HashMap<>();
        map.put("age",age);
        return map;
     }

     @PostMapping("/post")
    public Map<String,Object> getPst(@RequestBody String content){
        Map<String,Object> map=new HashMap<>();
        map.put("content",content);
        return map;
     }
}
